package mastermind.socket;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
import java.net.UnknownHostException;

import mastermind.gui.Frame;

public class socketConnect {
	private DataInputStream input;
	private DataOutputStream output;
	private Socket client;
	
	public socketConnect(String host, int port)
	{
		try 
		{
			client = new Socket(host,port);
			input = new DataInputStream(client.getInputStream());
			output = new DataOutputStream(client.getOutputStream());
		} 
		catch (NumberFormatException e) 
		{
			e.printStackTrace();
		} 
		catch (UnknownHostException e) 
		{
			e.printStackTrace();
		} 
		catch (IOException e) 
		{
			e.printStackTrace();
		}

	}
	
	public DataInputStream getInputStream()
	{
		return input;
	}
	
	public DataOutputStream getOutputStream()
	{
		return output;
	}
	
	public void closeSocket()
	{
		try 
		{
			input.close();
			output.close();
			client.close();
		} 
		catch (IOException e) 
		{
			e.printStackTrace();
		}

	}
}
